The invention relates to a method for homogenizing a static magnetic field with a magnetic field distribution B0(r) for nuclear magnetic resonance spectroscopy by adjusting the currents Ci through the shim coils, thus creating spatial field distributions Ci·Si(r), where r stands for one, two, or three of the spatial dimensions x, y, and z, and said magnetic field distribution B0(r) has only a field component along z, in a working volume of a magnetic resonance apparatus with one or more radio frequency (=RF) coils for inducing RF pulses and receiving RF signals within a working volume, said RF coils having a spatial sensitivity distribution of magnitudes B1k(r), and with shim coils for homogenizing the magnetic field within the working volume, said shim coils being characterized by their magnetic field distributions per unit current Si(r) and having components only along z.
Methods for homogenizing a magnetic field in the above mentioned manner are known from [1]-[4]
For NMR spectroscopy a very good homogeneity of the static magnetic field distribution B0(r) is required. Said B0(r) is often described as the local deviations from a spatially constant magnetic field value, which can e.g. be the average field over the working volume. In order to compensate for remaining inhomogeneities of the magnet and for field distortions due to other equipment (e.g. the probe head) and the sample, a set off shim coils is used to create an additional magnetic field. The magnetic field distributions per unit current Si(r) of said shim coils are called the “shim functions”. The procedure of shimming means finding the optimal choice of currents through the shim coils leading to optimal field homogeneity.
Each shimming procedure requires:    (i) a quality criterion for judging the homogeneity of the magnetic field and    (ii) an algorithm for modifying the shim currents in order to find the optimum of the criterion.Search Methods
Conventional shimming methods are based on a parameter search and work in an iterative way: An NMR measurement is performed, the value of the criterion is determined and evaluated, and the currents are modified accordingly. This procedure is repeated until the criterion fulfils a given absolute and/or relative condition for aborting the process.    (i) The chosen quality criterion is usually based on some kind of NMR measurement. It can be the lock level (i.e. the maximum value of the absorption lock signal) or some value determined from the time domain signal (FID) or from the frequency domain signal (spectrum) of a simple NMR experiment. In any case a more or less time-consuming NMR measurement is involved in each iteration. As a disadvantage of this kind of criterion, usually only a single aspect (e.g. width or height) of the resulting spectral line is considered. Therefore other important properties (e.g. smoothness or symmetry) are not taken into account.    (ii) There are many approaches for manually driven or computerised search algorithms for modifying the shim currents. In any case the problem is to find an optimum of the quality criterion with a limited number of iterations. However, often only local minima are obtained. Furthermore, many iterations may be necessary, so that shimming requires a considerable amount of time compared with the actual NMR experiment of interest. Generally speaking, the search methods suffer from not using any prior knowledge about the effect of the shim coils on the chosen criterion.The Projection Approach
In order to overcome the last restriction mentioned, Dunkel [1] proposed that the effect of a shim coil can be described by a histogram, i.e. a projection, of the shim function onto the magnetic field axis. After measuring an NMR spectrum and removal of the natural lines by deconvolution the obtained shape represents the effect of the current inhomogeneity on the lines in a spectrum. A fit procedure with the shim function projections can be performed to this shape to obtain coefficients for the shim currents that compensate the distortions of the lines.
However, as the projection operation mathematically is not a one-to-one transformation, the resulting current values are not unambiguous and may therefore be wrong. Furthermore, the fit procedure is often badly conditioned.
Gradient Shimming
The gradient shimming method (e.g. [2], [3], [4]) is different from the search methods in that it directly considers the spatial influence of the shim coils. With search methods the criteria are derived from the NMR signal which is integrated over the whole sample volume. In contrast to that, with gradient shimming the spatial magnetic field distribution B0(r) is mapped, with r representing up to three spatial dimensions. To this end, phase-sensitive NMR imaging is performed by means of magnetic field gradients. The shim function of each shim coil that is the magnetic field distribution per unit current Si(r) of the shim coils is also mapped while a certain current is applied to this coil. Based on the knowledge collected about the field distribution and the shim functions a set of shim currents Ci can be found that fulfils a given condition for minimising the remaining inhomogeneity.
In principle, it should be possible to find the required set of shim currents in a single step that involves mapping the field distribution only once. However, measurement inaccuracies favour multiple iterations similar to the search methods. In particular, when starting from a strongly inhomogeneous magnetic field, the quality of the measured data improves considerably after a few steps. However, as opposed to the search methods no optimisation algorithm is applied from iteration to iteration but the new currents are chosen “optimally” at each iteration according to the given mathematical instruction used for minimisation. Hence, the motivation for performing multiple iterations is different.
In the described conventional gradient shimming method the two aspects, criterion and algorithm, constitute the mathematical instruction:    (i) As a criterion very often a sum-of-squares of B0(r) over the region of interest is used, sometimes with some kind of spatial weighting.    (ii) This choice enables the use of a least-squares (LSQ) algorithm corresponding to a matrix inversion for direct calculation of the shim currents. Other criteria may require more complicated algorithms. Furthermore, constraints to the currents can be taken into account. Generally speaking, with gradient shimming the new shim values are chosen by means of an optimisation procedure that in the case of the LSQ criterion can be performed by direct calculation.
The main disadvantages of the described approach arise from the fact that a perfect solution corresponding to complete homogeneity is usually not possible, i.e. the residual field distribution B0R(r) is not constant. This means that many different solutions are possible for the “optimum” shim values depending on the chosen local weighting of spatial regions. The different solutions lead to different residual inhomogeneity with a corresponding spectral line shape. As there is no direct link between spatial inhomogeneity and spectral line shape, the described criteria derived in space do not ensure the quality of the result-of-interest, which is the NMR spectrum.
In connection with the approach of iteratively improving the result a further problem is raised. As the residual field cannot be brought to zero at all locations, the optimisation algorithm aims at an impossible result during each iteration. This leads to a limited convergence of the iterative shimming procedure due to differences in the errors of the field mapping results at successive iterations.